package arithmetic.LeetCode.Best_Time_to_Buy_and_Sell_Stock_II;

/**
 * @author zhangyanqi
 * @since 1.0 2017/10/12
 */
public class Solution {

    public int maxProfit(int[] prices) {
        int profit = 0;
        for (int i = 1; i < prices.length; i++) {
            int m = prices[i] - prices[i - 1];
            if (m > 0) {
                profit += m;
            }
        }
        return profit;
    }
}
